from django.db import models

# Create your models here.


class Classes(models.Model):

    classname = models.CharField(max_length=100, null=False, unique=True, verbose_name="班级")


class Teacher(models.Model):

    name = models.CharField(max_length=20, verbose_name="教师姓名")
    userid = models.CharField(max_length=100, verbose_name="账户", unique=True)
    password = models.CharField(max_length=20, verbose_name="密码")
    phone = models.IntegerField(verbose_name="手机号", null=True, unique=True)
    school_classes = models.ManyToManyField(Classes, null=True, default=None)


class Students(models.Model):

    name = models.CharField(max_length=20, verbose_name="学生姓名")
    userid = models.CharField(max_length=100, verbose_name="账户", unique=True)
    password = models.CharField(max_length=20, verbose_name="密码")
    phone = models.IntegerField(verbose_name="手机号", null=True, unique=True)
    school_classes = models.ForeignKey(Classes, on_delete=models.CASCADE)
